procedure lexicalanalysis (var line: str255; var removeblanks: boolean; var ntot: integer; var sy, tokentype: hdlstringarray0; var pr: hdlintarray0; var error: str255);
implementation
procedure lexicalanalysis;
label
99, 999, 9999;
type
indicate = array[1..maxnumberofstrings] of integer;
for i := 1 to numstrings do {meshing strings and operators to get}
for j := 1 to length(line) do {tokens, sy^^[i], i = 1, ntot}
begin
s1 := (j < nst^^[i]) and (i = 1);
s2 := (nend^^[i] < j) and (j < nst^^[i + 1]) and (i < numstrings);
s3 := (nend^^[i] < j) and (i = numstrings);
if s1 or s2 or s3 then
begin
ntot := ntot + 1;
sy^^[ntot] := line[j];
goto 9999;
end;
if (nst^^[i] = j) then
begin
ntot := ntot + 1;
sy^^[ntot] := astr^^[i];
goto 9999;
end;
if (nst^^[i] < j) and (j <= nend^^[i]) then
goto 9999;
9999:
end;
sy^^[0] := '@';
DisposHandle(handle(nst));
DisposHandle(handle(nend));
DisposHandle(handle(astr));
for i := 0 to ntot do {setting token types, tokentype^^[i], i = 1, ntot}
begin
tokentype^^[i] := 'string';
if (sy^^[i] = exponent) or (sy^^[i] = asterisk) or (sy^^[i] = rightslash) or (sy^^[i] = plus) or (sy^^[i] = minus) or (sy^^[i] = equals) or (sy^^[i] = rightparen) or (sy^^[i] = semicolon) or (sy^^[i] = leftparen) or (sy^^[i] = ampersand) then
tokentype^^[i] := 'binary';
if (sy^^[i] = 'pi') or (tokentype^^[i] = 'string') and (((48 <= ord(sy^^[i][1])) and (ord(sy^^[i][1]) <= 57)) or (ord(sy^^[i][1]) = 46)) then
tokentype^^[i] := 'constant';
if (sy^^[i] = '''') or (sy^^[i] = 'sqrt') or (sy^^[i] = 'sin') or (sy^^[i] = 'cos') or (sy^^[i] = 'exp') or (sy^^[i] = 'ln') then
tokentype^^[i] := 'function';
if (tokentype^^[i] = 'string') and (tokentype^^[i] <> 'binary') and (tokentype^^[i] <> 'constant') and (tokentype^^[i] <> 'function') then